//package com.shuziren.common;
//
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.shuziren.pojo.entity.InterviewSchedule;
//import com.shuziren.service.InterviewScheduleService;
//
//import com.shuziren.service.sms.InterviewReminderService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.EnableScheduling;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//
//import java.util.Date;
//import java.util.List;
//
//@Component
//@EnableScheduling
//public class InterviewReminderTask {
//
//    @Autowired
//    private InterviewScheduleService interviewScheduleService;
//    @Autowired
//    private InterviewReminderService reminderService;
//
//    @Scheduled(cron = "0 * * * * ?")
//    public void sendInterviewReminder() {
//        Date now = new Date();
//        Date tenMinutesLater = new Date(now.getTime() + 10 * 60 * 1000);
//        LambdaQueryWrapper<InterviewSchedule> queryWrapper = new LambdaQueryWrapper<>();
//        queryWrapper.eq(InterviewSchedule::getStatus, 1)
//                .eq(InterviewSchedule::getSendSms, 0)
//                .gt(InterviewSchedule::getInterviewTime, now)
//                .le(InterviewSchedule::getInterviewTime, tenMinutesLater);
//        List<InterviewSchedule> schedules = interviewScheduleService.list(queryWrapper);
//        schedules.forEach(reminderService::sendReminder);
//    }
//}
